<!DOCTYPE html>
<meta charset="UTF-8">
<table data-type="grid" title="格式化列" style="width: 700px; height: 250px"
	data-defs="rownumbers:true,singleSelect:true,iconCls:'icon-ok',border:false,headerCls:'byb',
		method:'get',url: '${rc.contextPath}/assets/ui/jww/demo/testdata/grid_data1.json',fit:true,fitColumns:true
		">
	<thead>
		<tr>
			<th data-defs="field:'itemid',width:80">ID</th>
			<th data-defs="field:'productid',width:200">产品名称</th>
			<th data-defs="field:'listprice',width:80,align:'right',formatter:formatPrice">成本</th>
			<th data-defs="field:'unitcost',width:80,align:'right'">单价</th>
			<th data-defs="field:'attr1',width:100">属性</th>
			<th data-defs="field:'status',width:60,align:'center'">状态</th>
		</tr>
	</thead>
</table>
<script>
	function formatPrice(val, row) {
	    if (val < 300) {
		    return '<span style="color:red;">(' + val + ')</span>';
	    } else {
		    return val;
	    }
    }
</script>
